package com.dynamic.controller;

import com.dynamic.entity.UserInfo;
import com.dynamic.service.UserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户信息
 *
 * @author Lance
 * @version 1.0.0
 * @data 2022-10-28 14:08
 */
@Api(tags = "用户信息")
@RestController
@RequestMapping("user")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;


    @GetMapping("master/{id}")
    @ApiOperation("【主库】信息")
    public UserInfo masterUserInfo(@PathVariable("id") String id) {

        return userInfoService.findMasterUserInfo(id);
    }

    @PostMapping("master/list")
    @ApiOperation("【主库】列表")
    public List<UserInfo> masterUserInfoList() {

        return userInfoService.findMasterUserInfoList();
    }

    @GetMapping("slave/{id}")
    @ApiOperation("【从库】信息")
    public UserInfo slaveUserInfo(@PathVariable("id") String id) {

        return userInfoService.findSlaveUserInfo(id);
    }

    @PostMapping("slave/list")
    @ApiOperation("【从库】列表")
    public List<UserInfo> slaveUserInfoList() {

        return userInfoService.findSlaveUserInfoList();
    }
}
